using System;
using System.Net;
using System.IO;


// MVC pattern - View component
// http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
public abstract class ReactionBase : IReaction
{
    protected ReactionBase() {
    }
    protected ReactionBase(string profile) {
        this.Profile = profile;
    }



    public string Profile { get; private set; }


    public bool PerformOperations() {
        string _;
        return PerformOperations(out _);
    }
    public virtual bool PerformOperations(out string error) {
        error = null;
        return true;
    }

    public virtual HttpStatusCode HttpStatusCode {
        get {
            if (Redirect) {
                return HttpStatusCode.Redirect;
            }
            else {
                return HttpStatusCode.OK;
            }
        }
        // for overriding
        protected set { throw new NotImplementedException(); }
    }

    public virtual string GetContent() {
        return "";
    }

    public virtual bool RequiresProfile { get { return false; } }

    public virtual bool Redirect { get { return false; } }

    public bool ValidateQuery(string query_string) {
        string _;
        return ValidateQuery(query_string, out _);
    }

    public virtual bool ValidateQuery(string query_string, out string error_message) {
        error_message = null;
        return true;
    }



    public virtual string RedirectLocation {
        get { throw new NotImplementedException(); }

    }





}


























